const fs = require('fs');
const path = require('path');
const server=require('../server');

module.exports = class {
    constructor() {
        server.start();

        this.loadLaunch();
    }

    static init() {
        return new this();
    }

    loadLaunch() {
        let areasPath = path.join(path.resolve(), 'areas');
        let dir = fs.readdirSync(areasPath);
        dir.forEach(item => {
            if (item.indexOf('.') < 0) {
                let launchFilePath = path.join(areasPath, item, 'launch.js');
                require(launchFilePath);
            }
        })
    }


};
